<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box{width: 100px;height: 100px;background: rebeccapurple;}
    </style>
    <!-- script里面 -->
    <script>
        // 事件
        onload = function () {
            let btn = document.getElementsByTagName('button')[0]
           
            btn.onclick = function () {
                alert('hello js')
            }
            let show=document.getElementsByClassName('show')[0]
            let hide=document.getElementsByClassName('hide')[0]
            let box=document.getElementsByClassName('box')[0]
            show.onclick=()=>{
                box.style.display='block'
            }
            hide.onclick=()=>{
                box.style.display='none'
            }


            box.onmouseover=()=>{
                box.style.display='none'
            }
            box.onmouseout=()=>{
                box.style.display='block'
            }

            



        }
    </script>

</head>

<body>
    <button>点击我</button>
    <button class="show">显示</button>
    <button class="hide">隐藏</button>
    <div class="box"></div>
</body>

</html>